<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@taglib uri="/struts-tags" prefix="s"%>
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>OA协同办公系统</title>
<link type="text/css" rel="stylesheet" href="css/table.css">
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/openwindow.js"></script>
<script type="text/javascript" src="js/file.js"></script>
<script type="text/javascript" src="js/flow.js"></script>
<script src="js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
		<style type="text/css">
		body,td,th {
			background-color:white;
			font-family: "宋体";
			font-size: 12px;
		}
		</style>
<script type="text/javascript">

function nextstep(id,user){
		var flag=validateReceive();
		if(!flag){
			return;
		}
		var table=$("#filetable").find("input[type=\"checkbox\"]");
		var textIds=$("#zhengwentable").find("input[type=\"checkbox\"]");
		var fileId="";
		var idArr="";
		for(var i=0;i<table.length;i++){
			fileId+="_"+table[i].value;
		}
		for(var i=0;i<textIds.length;i++){
			idArr+="_"+textIds[i].value;
		}
		$("#textId").val(idArr);
		$("#fileArray").val(fileId);
		var url="passDoc.action?nodeId="+id+"&executors="+user;
    	enableFields(document.getElementsByTagName("input"));
    	enableFields(document.getElementsByTagName("textarea"));
    	enableFields(document.getElementsByTagName("select"));
		$.post(url,$("form").serialize(),function(data){
			if(data=="success"){
				alert("操作成功");
				window.close();
				if($("#status").val()=='index'){
					window.opener.flowList();
				}else{
				var currentPage=$("#currentPage").val();
				window.opener.page(currentPage);
				}
			}else{
				alert("操作失败");
			}
		});
	}
	
	function flowLook(val) {
		var url = "flowLook.action?flowId="+val;
		openWindow(url, 680, 600);
	}
	
	
function submitNextNode(id,actorType){
	if(actorType=='2'){
		getcandidateR(id);
	}else if(actorType=='3'){
		getorguserR(id);
	}else if(actorType=='5'){
		selectUserR(id);
	}else{
		nextstep(id,'');
	}
}	
	
function setValue(value,id){
	nextstep(id,value);
}
function supervision(){
	$("#supervisionTag").val("1");
	alert("成功督办！");
	var user=$("#user").val();
	$("#info").html("由"+user+"督办");
}
</script>
  </head>
  
<body onload="download();getFiles('zhengwentable','textId');">
<input id="status" type="hidden" value="${status}">
<input type="hidden" id="currentPage" value="${currentPage}">
<form action="" method="post" name="documentForm" >
<div id="nodebutton" style="margin-left: 100px">
<table>
	<tr>
		<td>
	<input type="button" class="button_04" onclick="supervision()" value="督办">
	<c:forEach items="${nodeList}" var="task">
		<input type='button' class='button_04' onclick="submitNextNode('${task.id}','${task.actorType}')"  value='${task.name}'/>&nbsp;
	</c:forEach>
	</td><td>
		<input type="button" id="notShow" class="button_02"  value="退回" onclick="backShow(this.id)" />
	</td>
	<td>
	<span id="backList" style="display:none">
		<s:select id="backNodeId" list="backNodeList" listKey="id" listValue="name" headerKey="" headerValue="发起人" theme="simple"></s:select><input type="button" class="button_02"  value="确定" onclick="reject('${document.id}','${status}')" /><input type="button" class="button_02" id="yesShow"  value="取消" onclick="backShow('backList')" />
	</span>
	</td>
	<td><input type="checkbox"  value="1" name="message">短信提醒</td>
	<td>
		<input type="button" class="button_04"  value="流程查看" onclick="flowLook(${document.processId});" />
		</td></tr></table>
	</div>
	<div align="center"><h1 align="center"style="font-weight:bold">${document.flowName}</h1></div>
<input type="hidden" name="document.textId" id="textId" value="${document.textId}">
<input type="hidden" name="document.fileArray" id="fileArray" value="${document.fileArray}">
<input type="hidden"  name="document.id" value="${document.id}">
<input type="hidden" name="document.draftOrg" value="${document.draftOrg}">
<input type="hidden" name="document.draftUser" value="${document.draftUser}">
<input type="hidden" name="document.draftName" value="${document.draftName}">
<input type="hidden" name="document.draftStaus" value="${document.draftStaus}">
<input type="hidden" name="document.sfstatus" value="${document.sfstatus}">
<input type="hidden" name="document.createTime" value="${document.createTime}">
<input type="hidden" name="document.flowId" value="${flowId}">
<input type="hidden" name="document.processId" value="${document.processId}" >
<input type="hidden" id="contentid" name="document.contentId" value="${document.contentId}">
<input type="hidden" name="propertyIds" value="${propertyIds}" id="propertyIds"/>
<input type="hidden" value="${mustPropertyIds}" id="mustPropertyIds"/>
<table align="center" border="0" cellspacing="1" cellpadding="0" width="57%">
<tr>
<td width="60px">正文：</td>
<td colspan="7">&nbsp;<input type="button" class="button_04" id="zwsc" disabled="disabled" onclick="file_upload('zhengwentable')" value="上传附件"/> <input type="button" class="button_02"  onclick="fileDel('zhengwentable')"  value="删除"/>
	<table id="zhengwentable">
	
	</table></td>
</tr>
<td width="60px">附件：</td>
<td colspan="7">&nbsp;<input type="button" class="button_04" id="fjsc" disabled="disabled"  onclick="file_upload('filetable')" value="上传附件"/> <input type="button" class="button_02"  onclick="fileDel('filetable')"  value="删除"/>
	<table id="filetable">
	</table></td>
</tr>
</table>
<table align="center" style="margin-top:10px; background:#000"  border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td width="60">类型：</td>
    <td colspan="7"><s:select id="lx" onchange="typeChange(this.value)" disabled="disabled" list="departments" listKey="name" listValue="name" name="document.type" value="document.type" theme="simple" headerKey="" headerValue="--请选择--" cssStyle="width:200px"></s:select></td>
  </tr>
  <tr>
    <td width="60px">编号：</td>
    <td width="230px">
       <span id="fwzh" disabled="disabled">
       <input id="postFont1" disabled="disabled"  type="text" name="document.postFont1" value="${document.postFont1}"  style="width:100px;" maxlength="20"/>
        <s:select id="postFont2"  disabled="true"   onchange="typeChangeDate(this.value)" list="#{'[2007]':'2007','[2008]':'2008','[2009]':'2009','[2010]':'2010','[2011]':'2011','[2012]':'2012','[2013]':'2013','[2014]':'2014','[2015]':'2015','[2016]':'2016','[2017]':'2017','[2018]':'2018','[2019]':'2019','[2020]':'2020'}"  name="document.postFont2" headerKey="" headerValue="" value="document.postFont2" theme="simple"></s:select>
        <input  id="postFont3" disabled="disabled" type="text" name="document.postFont3" value="${document.postFont3}"  style="width:50px;" maxlength="20"/>
        </span>
    </td>
    <td width="70px">来文单位：</td>
    <td colspan="3" width="200px"><input id="lwdw" disabled="disabled" value="${document.fromDept}"  type="text" style="width:180px;" name="document.fromDept"/>
    <font style="font-weight:bold"  color="#FF0000">*</font></td>
    <td width="60px">文号：</td>
    <td><input id="wh" disabled="disabled" value="${document.articleNumber}"   type="text" style="width:150px;" name="document.articleNumber"/></td>
  </tr>
  <tr>
    <td>标题：</td>
    <td colspan="7"><input disabled="disabled" value="${document.title}" maxlength="80"  id="bt" type="text" style="width:97%;" name="document.title"/><font style="font-weight:bold"  color="#FF0000">*</font></td>
  </tr>
  <tr>
    <td>密级：</td>
    <td><s:select id="mj" cssStyle="width:100px" disabled="disabled" list="#{'秘密':'秘密','机密':'机密','绝密':'绝密'}" name="document.mjStatu" value="document.mjStatu" theme="simple" headerKey="" headerValue=""></s:select></td>
    <td>份数：</td>
    <td width="63"><input id="fs" maxlength="10" type="text" style="width:50px;" name="document.print" value="${document.print}"/></td>
    <td width="64">缓急程度：</td>
    <td width="79"><s:select id="hjcd" disabled="disabled" list="#{'加急':'加急','特急':'特急','特提':'特提'}" name="document.hjStatu" value="document.hjStatu" theme="simple" headerKey="" headerValue=""></s:select></td>
    <td>来文日期：</td>
    <td><input  id="lwrq" name="document.printTime" onclick="WdatePicker()" value="${document.printTime}" class="Wdate" type="text" disabled="disabled"></td>
  </tr>
  <tr>
    <td height="100" align="center">
       <p>&nbsp;</p>
    	拟<br><br>
    	办<br><br>
         意<br><br>
    	见
   	 <p>&nbsp;</p>
   </td>
    <td colspan="7">
    &nbsp;&nbsp;${document.nbyj}
    <textarea id="nbyj" disabled="disabled" name="nbyj" style=" width:500px; height:120px; border:0; overflow:hidden"></textarea>
    </td>
  </tr>
  <tr>
   <td height="100" align="center">
      <p>&nbsp;</p>
        部<br><br>
        门<br><br>
        负<br><br>
        责<br><br>
        人<br><br>
        意<br><br>
        见
      <p>&nbsp;</p>
    </td>
    <td colspan="7">
    &nbsp;&nbsp;${document.dcdb}
    <textarea id="dcdb" disabled="disabled"  name="dcdb" style=" width:500px; height:120px; border:0; overflow:hidden"></textarea>
    </td>
  </tr>
  <tr>
    <td height="100" align="center">
   <p>&nbsp;</p>
        局<br><br>
        领<br><br>
        导<br><br>
        批<br><br>
        示
     <p>&nbsp;</p>
    </td>
    <td colspan="7">
    &nbsp;&nbsp;${document.ldps}
    <textarea id="ldps" disabled="disabled" name="ldps" style=" width:500px; height:120px; border:0; overflow:hidden"></textarea>
    </td>
  </tr>
  <tr>
    <td height="100" align="center">
     <p>&nbsp;</p>
        办<br><br>
        理<br><br>
        情<br><br>
        况
     <p>&nbsp;</p>
  </td>
    <td colspan="7">
    &nbsp;&nbsp;${document.blqk }
    <textarea id="blqk" disabled="disabled" name="blqk"  style=" width:500px; height:120px; border:0; overflow:hidden"></textarea>
    </td>
  </tr>
  <tr>
    <td height="80" align="center">
       <p>&nbsp;</p>
         备<br><br>
         注
     <p>&nbsp;</p>
   </td>
    <td colspan="7">
    <textarea id="bz" disabled="disabled" name="document.beizhu" style=" width:500px; height:70px; border:0; overflow:hidden">  ${document.beizhu}</textarea>
    </td>
  </tr>
    <tr>
	<input type="hidden" id="user" value="${sessionScope.userInfo.name }">
	<input id="supervisionTag" type="hidden" name="supervisionTag">
	<input type="hidden" name="document.supervision" value="${document.supervision }">
	<td id="info" style="color: red;" height="10" colspan="8">${document.supervision }</td>
  </tr>
</table>
<div align="center">
<table><tr>
<td>
	<c:forEach items="${nodeList}" var="task">
		<input type='button' class='button_04' onclick="submitNextNode('${task.id}','${task.actorType}')"  value='${task.name}'/>&nbsp;
	</c:forEach>
	</td><td>
		<input type="button" id="notShow2" class="button_02"  value="退回" onclick="backShow(this.id)" />
	</td>
	<td>
	<span id="backList2" style="display:none">
		<s:select id="backNodeId" list="backNodeList" listKey="id" listValue="name" headerKey="" headerValue="发起人" theme="simple"></s:select><input type="button" class="button_02"  value="确定" onclick="reject('${document.id}','${status}')" /><input type="button" class="button_02" id="yesShow"  value="取消" onclick="backShow('backList2')" />
	</span>
	</td>
	<td><input type="checkbox" value="1" name="message">短信提醒</td>
	</tr></table>
	</div>
</form>
</body>
</html>
